#include <gtest/gtest.h>
#include <iostream>
#include <unordered_map>


std::unordered_map<int, int> gdict;

class Suit : public testing::Test
{
public:
    static void SetUpTestCase()
    {
        std::cout << "总环境初始化..." << std::endl;
        gdict[0] = 0;
    }
    virtual void SetUp() override
    {
        std::cout << "_dict初始化..." << std::endl;
        _dict[1] = 1; 
        _dict[2] = 2;
    }
    virtual void TearDown() override
    {
        std::cout << "_dict销毁..." << std::endl;
        _dict.clear();
    }
    static void TearDownTestCase()
    {
        std::cout << "总环境释放..." << std::endl;
        gdict.clear();
    }
public:
    std::unordered_map<int, int> _dict;
};

TEST_F(Suit, test1) //单元测试的名字必须和类名一样
{
    _dict[3] = 3;
    EXPECT_EQ(_dict.size(), 3);
    EXPECT_EQ(gdict.size(), 1);
    gdict[3] = 3;
}

TEST_F(Suit, test2) 
{
    EXPECT_EQ(_dict.size(), 2);
    EXPECT_EQ(gdict.size(), 2);
}

int main(int argc, char* argv[])
{
    testing::InitGoogleTest(&argc, argv);       //函数名写第三遍，别忘了
    return RUN_ALL_TESTS();
}

